<!-- 💥 这里是一次性加载 LayoutComponents -->
<template>
  <el-watermark id="watermark" :font="font" :content="watermark ? ['Midas Insight', 'Happy Working'] : ''">
    <component :is="LayoutComponents[layout]" />
    <ThemeDrawer />
  </el-watermark>
</template>

<script setup lang="ts" name="layout">
import { computed, reactive, watch, type Component } from "vue";
import { LayoutType } from "@/stores/interface";
import { useGlobalStore } from "@/stores/modules/global";
import ThemeDrawer from "./components/ThemeDrawer/index.vue";
import LayoutVertical from "./LayoutVertical/index.vue";
import LayoutClassic from "./LayoutClassic/index.vue";
import LayoutTransverse from "./LayoutTransverse/index.vue";
import LayoutColumns from "./LayoutColumns/index.vue";

const LayoutComponents: Record<LayoutType, Component> = {
  vertical: LayoutVertical,
  classic: LayoutClassic,
  transverse: LayoutTransverse,
  columns: LayoutColumns
};

const globalStore = useGlobalStore();

const isDark = computed(() => globalStore.isDark);
const layout = computed(() => globalStore.layout);
const watermark = computed(() => globalStore.watermark);

const font = reactive({ color: "rgba(0, 0, 0, .15)" });
watch(isDark, () => (font.color = isDark.value ? "rgba(255, 255, 255, .15)" : "rgba(0, 0, 0, .15)"), {
  immediate: true
});
</script>

<style scoped lang="scss">
.layout {
  min-width: 600px;
}
</style>

<!-- {id: 6, substation_name: "美登思临港工厂", project_name: "美登思能源技术有限公司10kV变电站",…}
created_at
: 
"2025-08-09T10:41:30.772Z"
deviceoverview
: 
"总容量 500kVA变压器（500kVA） 1 台 10kV开关柜 4 台 400V开关柜 8 台"
electric_service
: 
"张春军 联系电话 13817343786"
id
: 
6
project_address
: 
"上海市临港新片区沧海路2828号4号楼"
project_insight_applic_pro
: 
"子站系统 1 套 10kV进线开关柜1 套、400V光伏接入开关柜 1 套 10kV测试开关柜 1 套"
project_name
: 
"美登思能源技术有限公司10kV变电站"
project_oper_time
: 
"2024/05/21"
substation_name
: 
"美登思临港工厂"
updated_at
: 
"2025-08-09T10:41:30.772Z" -->
